<extend name="Base/common" />
<block name="body">
  <div class="span9 page_message">
    <section id="contents"> <include file="Addons/_nav" />
      <!--<div class="table-bar">
        <div class="search-form fr cf">
          <div class="sleft">
            <php> $get_param[model]=$model['name']; $search_url || $search_url = addons_url($_REQUEST ['_addons'].'://'.$_REQUEST ['_controller'].'/lists', $get_param);</php>
            <php>empty($search_key) && $search_key=$model['search_key'];empty($search_key) && $search_key='title';</php>
            <input type="text" name="{$search_key}" class="search-input" value="{:I($search_key)}" placeholder="{$placeholder}">
            <a class="sch-btn" href="javascript:;" id="search" url="{$search_url}"><i class="btn-search"></i></a> </div>
        </div>
      </div>-->
      <!-- 数据列表 -->
      <div class="data-table">
      
        <div class="table-striped">
        
          <table cellspacing="0" class="message_list">
            <thead>
            	<tr>
                	<th  width="50%">最近回复</th>
                    <th  width="25%">回复时间</th>
                    <th  width="25%">查看消息</th>
                </tr>
            </thead>
            <!-- 列表 -->
            <tbody>
            <volist name="list_data" id="vo">
              <tr>
                <tr>
                  <td class="user">
                	<notempty name="vo[user][headimgurl]">
                		<img width="50" src="{$vo.user.headimgurl}"/>
                    <else/>
                    	<img width="50" src="__IMG__/default.png"/>
                    </notempty>
                	<div class="u_info">
                    	<notempty name="vo[user][headimgurl]">
                            <p class="name">{$vo.user.nickname}</p>
                        <else/>
                            <p class="name">{$vo.openid}</p>
                        </notempty>
                    	
                        <p class="msg">{$vo.Content}</p>
                    </div>
                </td>
                <td valign="top">{$vo.CreateTime|time_format}</td>
                <td valign="top">
                
                <eq name="vo.collect" value="0">
                <a href="javascript:void(0)" onclick="set_status({$vo.id},'collect', 1)">收藏</a>
                <else />
                <a href="javascript:void(0)" onclick="set_status({$vo.id},'collect', 0)">取消收藏</a>
                </eq>
                
                <eq name="vo.deal" value="0">
                <a href="javascript:void(0)" onclick="set_status({$vo.id},'deal', 1)">设为待处理</a>
                <else />
                <a href="javascript:void(0)" onclick="set_status({$vo.id},'deal', 0)">取消处理状态</a>
                </eq>
                
                <php>if(C('SEND_CUSTOM_MSG') && (NOW_TIME-$vo[CreateTime])<172800) { </php><!--48小时以内可以回复用户-->
                <a href="{:U('person',array('openid'=>$vo['FromUserName']))}" >快速回复</a>
                <php> } </php>
                </td>
              </tr>
              </volist>
            </tbody>
          </table>
        </div>
      </div>
      <div class="page"> {$_page|default=''} </div>
    </section>
  </div>
</block>
<block name="script"> 
  <script type="text/javascript">
$(function(){
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
        if(query == '' ){
        	url="{:addons_url($_REQUEST ['_addons'].'://'.$_REQUEST ['_controller'].'/lists')}";
        }
		window.location.href = url;
	});

    //回车自动提交
    $('.search-form').find('input').keyup(function(event){
        if(event.keyCode===13){
            $("#search").click();
        }
    });

})
function set_status(id, field, val){
   $.post("{:U('set_status')}",{id:id,field:field,val:val},function(){
	   location.reload();
   })	
}
</script> 
</block>
